(function (vc) {
    var DEFAULT_PAGE = 1;
    var DEFAULT_ROWS = 10;
    vc.extends({
        data: {
            aRefundDepositInfo: {
                fees: [],
                ownerId: '',
                roomId: '',
                roomName: '',
                total: 0,
                records: 0
            }
        },
        _initMethod: function () {
        },
        _initEvent: function () {
            //切换 至费用页面
            vc.on('aRefundDeposit', 'switch', function (_param) {
                if (!_param.roomId) {
                    return;
                }
                $that.clearSimplifyFeeDepositInfo();
                vc.copyObject(_param, $that.aRefundDepositInfo)
                $that._listSimplifyFeeDeposit(DEFAULT_PAGE, DEFAULT_ROWS);
            });
            vc.on('aRefundDeposit', 'paginationPlus', 'page_event',
                function (_currentPage) {
                    $that._listSimplifyFeeDeposit(_currentPage, DEFAULT_ROWS);
                }
            );
        },
        methods: {
            _listSimplifyFeeDeposit: function (_page, _rows) {
                let param = {
                    params: {
                        page: DEFAULT_PAGE,
                        row: DEFAULT_ROWS,
                        payerObjId: $that.aRefundDepositInfo.roomId,
                        ownerId: $that.aRefundDepositInfo.ownerId,
                        state:'1400',
                    }
                };
                //发送get请求
                vc.http.apiGet('/fee.queryAdminFeeDeposit',
                    param,
                    function (json, res) {
                        let _json = JSON.parse(json);
                        if(_json.code != 0){
                            return;
                        }
                        $that.aRefundDepositInfo.total = _json.total;
                        $that.aRefundDepositInfo.records = _json.records;
                        $that.aRefundDepositInfo.fees = _json.data;
                        vc.emit('aRefundDeposit', 'paginationPlus', 'init', {
                            total: $that.aRefundDepositInfo.records,
                            dataCount: $that.aRefundDepositInfo.total,
                            currentPage: _page
                        });
                    }, function (errInfo, error) {
                        console.log('请求失败处理');
                    }
                );
            },
            clearSimplifyFeeDepositInfo: function () {
                $that.aRefundDepositInfo = {
                    fees: [],
                    ownerId: '',
                    roomId: '',
                    roomName: '',
                    total: 0,
                    records: 0
                }
            },
            _openRefundModel: function (_fee) {
                let _roomId = $that.aRefundDepositInfo.roomId;
                vc.jumpToPage('/#/pages/fee/refundDepositFee?roomId='+_roomId);
            },
            _toSimplifyFeeDepositFeeDetail:function(_fee){
                vc.jumpToPage('/#/pages/property/propertyFee?feeId='+_fee.feeId);
            },
        }
    });
})(window.vc);